namespace net.podhola.gtd.finances

import System
import net.podhola
import net.podhola.gtd

[Castle.ActiveRecord.ActiveRecord]
class Expense(Castle.ActiveRecord.ActiveRecordBase of Expense):
	_id as int	
	[Castle.ActiveRecord.PrimaryKey(Castle.ActiveRecord.PrimaryKeyType.Increment)]
	Id as int:
		get: return _id
		set: _id = value

	_subject as string	
	[Castle.ActiveRecord.Property] 
	Subject as string:
		get: return _subject
		set: _subject = value
	
	_spentOn as DateTime		
	[Castle.ActiveRecord.Property] 
	SpentOn as DateTime:
		get: return _spentOn
		set: _spentOn = value

	_fromAccount as Account
	[Castle.ActiveRecord.BelongsTo("accountid")]  
	FromAccount as Account:
		get: return _fromAccount
		set: 
			_fromAccount = value
			_fromAccount.Expenses.Add( self )

	_amount as double
	[Castle.ActiveRecord.Property] 
	Amount as double:
		get: return _amount
		set: _amount = value

	_hasPayedBill as EnteredBill
	[Castle.ActiveRecord.BelongsTo("billid")] 
	HasPayedBill as EnteredBill:
		get: return _hasPayedBill
		set: _hasPayedBill = value
